$(document).ready(function(){
	$('#btn_login').click(function(){
		var nip_user=$('#nip').val();
		var password_user = $('#password').val();

		if(nip_user==='' || password_user===''){
			$('#error').html("NIP dan Password Harus Diisi !").fadeIn(500);
		}else {
			$.post('controller/cont.login.php',{login:true, nip:nip_user,password:password_user}, function(data){
				if(data.msg){
					window.location = 'main.php';
				}else{
					$('#error').html(data.error).fadeIn(500).delay(2500).fadeOut(500);
				}
			},'json');
		}
		return false;
	});

});